﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Data;
using System.Net;

namespace YYS
{
    /// <summary>
    /// 实用方法
    /// </summary>
    public class Utility
    {
        #region
        /// <summary>
        /// 获取Mac地址
        /// </summary>
        /// <returns></returns>
        public static string GetMacString()
        {
            string strMac = "";
            System.Net.NetworkInformation.NetworkInterface[] interfaces = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();
            foreach (System.Net.NetworkInformation.NetworkInterface ni in interfaces)
            {
                if (ni.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up)
                {
                    var mac = ni.GetPhysicalAddress().ToString().Trim();
                    if (mac.Length > 0)
                    {
                        strMac += mac + "|";
                    }
                }
            }
            return strMac.TrimEnd('|');
        }
        #endregion

        #region Service Pwd
        public const string mws_PayMoney_Name = "mws_PayMoney";
        public const string mws_PayMoney_Pwd = "mws_PM_0000";

        public const string mws_MoneyList_Name = "mws_MoneyList";
        public const string mws_MoneyList_Pwd = "mws_ML_0000";

        public const string mws_MoneyError_Name = "mws_MoneyError";
        public const string mws_MoneyError_Pwd = "mws_ME_0000";

        public const string mws_Other_Name = "redone";
        public const string mws_Other_Pwd = "SuperStar@2004";
        #endregion

        #region  正则验证
        /// <summary>
        /// 正则验证
        /// </summary>
        /// <param name="str">要验证的字符串</param>
        /// <param name="regex">正则</param>
        /// <returns></returns>
        public static bool regexValid(string str, string regex)
        {
            bool bl = false;
            try
            {
                Regex re = new Regex(regex);
                bl = re.Match(str).Success;
            }
            catch { }
            return bl;
        }
        /// <summary>
        /// 判断是否数字
        /// </summary>
        /// <param name="str"></param>
        public static bool checkNum(string str, int minLen = 0, int maxLen = 0)
        {
            var reg = @"^\d";
            if (minLen <= 0) minLen = 1;
            reg += "{" + minLen + ",";
            if (maxLen > 0)
            {
                reg += "" + maxLen + "";
            }
            reg += "}$";
            return regexValid(str, reg);
        }

        /// <summary>
        /// 检查邮件地址
        /// </summary>
        /// <param name="email">邮件地址</param>
        /// <returns></returns>
        public static bool IsEmail(string email)
        {
            return email.xIsEmail();
        }
        /// <summary>
        /// 检查电话号码（字符串）
        /// </summary>
        /// <param name="phone">字符串</param>
        /// <returns></returns>
        public static bool IsPhone(string phone)
        {
            return phone.xIsPhone();
        }
        /// <summary>
        /// 验证是否手机号
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool isMobile(string str)
        {
            return str.xIsMobile();
        }

        public static bool isIP(string str)
        {
            return str.xIsIP();
        }

        /// <summary>
        /// 验证用户名只能包含字母数字或下划线
        /// </summary>
        /// <param name="str"></param>
        /// <param name="minLen"></param>
        /// <param name="maxLen"></param>
        /// <returns></returns>
        public static bool isRegexName(string str, int minLen, int maxLen)
        {
            return regexValid(str, @"^[a-zA-Z0-9_]{" + minLen + "," + maxLen + "}$");
        }
        /// <summary>
        /// 验证密码只能包含字母、数字、_、@、#
        /// </summary>
        /// <param name="str"></param>
        /// <param name="minLen"></param>
        /// <param name="maxLen"></param>
        /// <returns></returns>
        public static bool isRegexPwd(string str, int minLen, int maxLen)
        {
            return regexValid(str, @"^[a-zA-Z0-9_@#]{" + minLen + "," + maxLen + "}$");
        }
        /// <summary>
        /// YYYY-MM-dd
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool isDate(string str)
        {
            return str.xIsDate();
        }
        /// <summary>
        /// yyyy-MM-dd HH:mm:ss
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool isDateTime(string str)
        {
            return str.xIsDateTime();
        }
        /// <summary>
        /// 判断类型
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="value"></param>
        /// <returns></returns>
        public static bool isT<T>(object value)
        {
            try
            {
                ChangeType(value, typeof(T));
                return true;
            }
            catch
            {
                return false;
            }
        }
        #endregion

        /// <summary>
        /// 判断str=null或str.Trim()=""
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool isEmpty(string str)
        {
            if (str == null || str.Trim().Length == 0)
            {
                return true;
            }
            return false;
        }
        /// <summary>
        /// 比较两个日期
        /// </summary>
        /// <param name="sBTime">YYYY-MM-dd</param>
        /// <param name="sETime"></param>
        /// <param name="isNull">日期是否可以为空</param>
        /// <param name="dBTime">输出 开始日期</param>
        /// <param name="dETime">输出 结束日期</param>
        /// <returns></returns>
        public static string compareDate(string sBTime, string sETime, bool isNull, out DateTime? dBTime, out DateTime? dETime)
        {
            string str = null;
            dBTime = null;
            dETime = null;
            try
            {
                if (isNull)
                {
                    if (!string.IsNullOrEmpty(sBTime))
                    {
                        if (!isDate(sBTime)) return "开始日期格式不正确；";
                        else dBTime = DateTime.Parse(sBTime);
                    }
                    if (!string.IsNullOrEmpty(sETime))
                    {
                        if (!isDate(sETime)) return "结束日期格式不正确；";
                        else dETime = DateTime.Parse(sETime);
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(sBTime)) return "开始日期不能为空；";
                    if (!isDate(sBTime)) return "开始日期格式不正确；";
                    else dBTime = DateTime.Parse(sBTime);
                    if (string.IsNullOrEmpty(sETime)) return "结束日期不能为空；";
                    if (!isDate(sETime)) return "结束日期格式不正确；";
                    else dETime = DateTime.Parse(sETime);
                }
                if (dBTime != null && dETime != null)
                {
                    DateTime d1 = (DateTime)dBTime;
                    DateTime d2 = (DateTime)dETime;
                    TimeSpan s = d2.Subtract(d1);
                    if (s.TotalDays < 0)
                    {
                        return "结束日期必须大于开始日期；";
                    }
                }
            }
            catch (Exception ex)
            {
                str = ex.Message;
            }
            return str;
        }

        public static string JoinCollection(ICollection<object> coll, char splitChar = ',')
        {
            StringBuilder sb = new StringBuilder();
            foreach (var o in coll)
            {
                sb.Append(o);
                sb.Append(splitChar);
            }
            return sb.ToString().TrimEnd(new char[] { splitChar });
        }

        public static void Each<T>(ICollection<T> cols, Action<T> func)
        {
            if (cols != null)
            {
                foreach (var o in cols)
                {
                    func(o);
                }
            }
        }

        public static List<string> SplitString(string str, char splitChar = ',')
        {
            return str.Split(splitChar).ToList<string>();
        }
        public static List<int> SplitInt(string str, char splitChar = ',')
        {
            var p = new List<int>();
            var arr = str.Split(splitChar);
            foreach (var o in arr)
            {
                p.Add(Convert.ToInt32(o));
            }
            return p;
        }
        /// <summary>
        /// 移除字符串末尾指定字符
        /// </summary>
        /// <param name="sourceString">源字符串</param>
        /// <param name="deletingString">要移除的字符串</param>
        /// <returns></returns>
        public static string RemoveAtEnd(string sourceString, string deletingString)
        {
            if (sourceString.Contains(deletingString))
            {
                int len1 = sourceString.Length;
                int len2 = deletingString.Length;
                int pos = len1 - len2;
                if (pos >= 0)
                {
                    string temp = sourceString.Substring(pos);
                    if (temp.ToUpper().Equals(deletingString.ToUpper()))
                    {
                        return sourceString.Remove(pos, len2);
                    }
                }
            }
            return sourceString;
        }

        /// <summary>
        /// 获取异常明细（包括发生时间，详细信息，文件跟踪信息）
        /// </summary>
        /// <param name="ex">异常</param>
        /// <param name="ParameterInfo">可选 参数信息</param>
        /// <returns></returns>
        public static string getExceptionDetail(Exception ex, string ParameterInfo = null)
        {
            if (ex != null)
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("★异常发生时间：");
                sb.Append(DateTime.Now);
                sb.Append(System.Environment.NewLine);
                sb.Append("★异常明细：");
                sb.Append(System.Environment.NewLine);
                sb.Append(ex.ToString());
                sb.Append(System.Environment.NewLine);
                sb.Append("★文件跟踪信息：");
                sb.Append(System.Environment.NewLine);
                System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(true);
                for (int i = 0; i < st.FrameCount; i++)
                {
                    var sf = st.GetFrame(i);
                    if (!String.IsNullOrEmpty(sf.GetFileName()))
                    {
                        sb.Append(string.Format("   ●在 {0} 的 {1}；位置 {2} 行号：{3} {4}", sf.GetMethod().DeclaringType, sf.GetMethod(), sf.GetFileName(), sf.GetFileLineNumber(), System.Environment.NewLine));
                    }
                }
                if (ParameterInfo != null)
                {
                    sb.Append(System.Environment.NewLine);
                    sb.Append("★参数信息：");
                    sb.Append(System.Environment.NewLine);
                    sb.Append(ParameterInfo);
                }
                return sb.ToString();
            }
            return null;
        }

        /// <summary>
        /// 生成随机数
        /// </summary>
        /// <param name="length"></param>
        /// <returns></returns>
        public static string getRand(int length)
        {
            Random rad = new Random();
            string str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            var list = DateTime.Now.ToString("yyyyMMddHHmmssfff").Reverse().Concat(newId()).Concat(str).ToArray();
            list = list.OrderBy(x => rad.Next(0, list.Length)).ToArray();
            str = new String(list);
            return str.Substring(0, length);
        }

        /// <summary>
        /// 全局唯一标识符
        /// </summary>
        public static string newId()
        {
            return Guid.NewGuid().ToString("N");
        }
        /// <summary>
        /// ping server
        /// </summary>
        /// <param name="ip"></param>
        /// <returns></returns>
        public static bool Ping(string ip)
        {
            try
            {
                System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
                System.Net.NetworkInformation.PingOptions pingOptions = new System.Net.NetworkInformation.PingOptions();
                pingOptions.DontFragment = true;
                string data = "Test Data";
                byte[] buffer = Encoding.UTF8.GetBytes(data);
                int timeout = 3000; // Timeout 时间，单位：毫秒
                System.Net.NetworkInformation.PingReply pingReply = ping.Send(ip, timeout, buffer, pingOptions);
                return pingReply.Status == System.Net.NetworkInformation.IPStatus.Success;
            }
            catch { return false; }
        }

        /// <summary>
        /// 发送互学通邮件
        /// </summary>
        /// <param name="strEmail">邮件地址</param>
        /// <param name="strSubject">邮件标题</param>
        /// <param name="strBody">邮件内容</param>
        /// <param name="IsHtml">是否HTML邮件</param>
        /// <returns></returns>
        public static string SendHXTMail(string strEmail, string strSubject, string strBody, bool IsHtml = false)
        {
            string Result = null;
            try
            {
                if (strEmail.Length <= 0)
                {
                    return "邮件地址为空";
                }
                string[] arr = strEmail.Split(',');
                System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
                msg.From = new System.Net.Mail.MailAddress("no-reply@kmhjt.com", "小杨工具库", System.Text.Encoding.UTF8);
                msg.Subject = strSubject;
                msg.SubjectEncoding = System.Text.Encoding.UTF8;
                msg.IsBodyHtml = IsHtml;
                msg.Priority = System.Net.Mail.MailPriority.Normal;
                msg.Body = strBody;
                msg.BodyEncoding = System.Text.Encoding.UTF8;
                System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.qq.com", 587);
                smtp.UseDefaultCredentials = true;
                smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                // smtp.Credentials = new System.Net.NetworkCredential("kmhjt", "Star@2008");
                for (int i = 0; i < arr.Length; i++)
                {
                    msg.To.Clear();
                    msg.To.Add(arr[i].Trim());
                    smtp.Send(msg);
                }
            }
            catch (Exception ex)
            {
                Result = ex.Message;
            }
            if (Result != null)
            {
                Result = Result.Replace("'", "’");
            }
            return Result;
        }

        /// <summary>
        /// 发邮件（接收人邮件地址,标题，内容）
        /// </summary>
        /// <param name="strEmail">接收人邮件地址，多个用“,”隔开</param>
        /// <param name="strSubject">标题</param>
        /// <param name="strBody">内容</param>
        /// <param name="IsHtml">内容是否HTML脚本</param>
        /// <returns></returns>
        public static bool SendMail(string strEmail, string strSubject, string strBody, bool IsHtml = false)
        {
            bool flag = false;
            try
            {
                if (strEmail.Length <= 0)
                {
                    return flag;
                }
                string[] arr = strEmail.Split(',');
                System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
                msg.From = new System.Net.Mail.MailAddress("jusliang@126.com", "AutoSystem", System.Text.Encoding.Default);
                for (int i = 0; i < arr.Length; i++)
                {
                    msg.To.Add(arr[i].Trim());
                }
                msg.Subject = strSubject;
                msg.SubjectEncoding = System.Text.Encoding.Default;
                msg.IsBodyHtml = false;
                msg.Priority = System.Net.Mail.MailPriority.High;
                msg.Body = strBody;
                msg.BodyEncoding = System.Text.Encoding.Default;
                System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
                smtp.Host = "smtp.126.com";
                smtp.Credentials = new System.Net.NetworkCredential("jusliang", "jusliang@1986");
                smtp.Send(msg);
                flag = true;
            }
            catch { }
            return flag;
        }

        #region 加密解密
        /// <summary>
        /// MD5算法加密32位小写
        /// </summary>
        /// <param name="sStr">要加密的字符串</param>
        /// <param name="nNum">加密次数</param>
        /// <returns></returns>
        public static string EncryptMd5(string sStr, int nNum)
        {
            if (nNum <= 0)
            {
                nNum = 1;
            }
            for (int i = 0; i < nNum; i++)
            {
                byte[] result = System.Text.Encoding.Default.GetBytes(sStr);
                System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
                byte[] output = md5.ComputeHash(result);
                sStr = BitConverter.ToString(output).Replace("-", "").ToLower();
            }
            return sStr.ToLower();

        }
        /// <summary>
        /// MD5算法加密32位小写
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string EncryptMd5(string str)
        {
            byte[] result = System.Text.Encoding.UTF8.GetBytes(str);
            System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
            byte[] output = md5.ComputeHash(result);
            str = BitConverter.ToString(output).Replace("-", "").ToLower();
            return str.ToLower();
        }
        /// <summary>
        /// SHA1 加密
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string EncryptSHA1(string str)
        {
            System.Security.Cryptography.SHA1CryptoServiceProvider mhash = new System.Security.Cryptography.SHA1CryptoServiceProvider();
            byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(str);
            byte[] bytHash = mhash.ComputeHash(bytValue);
            mhash.Clear();
            str = Convert.ToBase64String(bytHash);
            return str;
        }

        #region  .Net自带加密
        /// <summary>
        /// .Net自带加密
        /// </summary>
        /// <param name="str">加密字符串</param>
        /// <param name="num">加密次数</param>
        /// <param name="encryptType">加密方式（MD5/SHA1）</param>
        public static string EncryptNet(string str, int num, string encryptType)
        {
            if (str.ToLower() == "admin")
            {
                str = str.ToLower();
            }
            if (num <= 0)
            {
                num = 1;
            }
            for (int i = 0; i < num; i++)
            {
                str = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, encryptType);
            }
            return str;
        }
        /// <summary>
        /// .Net自带加密
        /// </summary>
        /// <param name="str"></param>
        /// <param name="encryptType">加密方式（MD5/SHA1）</param>
        /// <returns></returns>
        public static string EncryptNet(string str, string encryptType)
        {
            return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, encryptType); ;
        }

        #endregion

        #region DES
        static byte[] IV_Keys = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
        static byte[] RGB_Keys = Encoding.UTF8.GetBytes("DESOFHXT");
        /// <summary>
        /// DES 加密
        /// </summary>
        /// <param name="encryptString"></param>
        /// <returns></returns>
        public static string EncryptDES(string encryptString)
        {
            var str = encryptString;
            try
            {
                byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString);
                System.Security.Cryptography.DESCryptoServiceProvider dCSP = new System.Security.Cryptography.DESCryptoServiceProvider();
                using (MemoryStream mStream = new MemoryStream())
                {
                    using (System.Security.Cryptography.CryptoStream cStream = new System.Security.Cryptography.CryptoStream(mStream, dCSP.CreateEncryptor(RGB_Keys, IV_Keys), System.Security.Cryptography.CryptoStreamMode.Write))
                    {
                        cStream.Write(inputByteArray, 0, inputByteArray.Length);
                        cStream.FlushFinalBlock();
                        str = Convert.ToBase64String(mStream.ToArray());
                    }
                }
            }
            catch { }
            return str;
        }
        /// <summary>
        /// DES 解密
        /// </summary>
        /// <param name="decryptString"></param>
        /// <returns></returns>
        public static string DecryptDES(string decryptString)
        {
            var str = string.Empty;
            try
            {
                byte[] inputByteArray = Convert.FromBase64String(decryptString);
                System.Security.Cryptography.DESCryptoServiceProvider DCSP = new System.Security.Cryptography.DESCryptoServiceProvider();
                using (MemoryStream mStream = new MemoryStream())
                {
                    using (System.Security.Cryptography.CryptoStream cStream = new System.Security.Cryptography.CryptoStream(mStream, DCSP.CreateDecryptor(RGB_Keys, IV_Keys), System.Security.Cryptography.CryptoStreamMode.Write))
                    {
                        cStream.Write(inputByteArray, 0, inputByteArray.Length);
                        cStream.FlushFinalBlock();
                        str = Encoding.UTF8.GetString(mStream.ToArray());
                    }
                }
            }
            catch { }
            return str;
        }

        #endregion

        #region AES
        static string saltValue = "8f3e60f359e948cb90b35f888ead63bb";
        static string pwdValue = "2b96f3523d344440801021ca2da0b4ac";
        /// <summary>
        /// AES 加密
        /// </summary>
        /// <param name="input">加密前的字符串</param>
        /// <returns>加密后的字符串</returns>
        public static string EncryptAES(string input)
        {
            string str = input;
            try
            {
                byte[] data = System.Text.UTF8Encoding.UTF8.GetBytes(input);
                byte[] salt = System.Text.UTF8Encoding.UTF8.GetBytes(saltValue);
                // AesManaged - 高级加密标准(AES) 对称算法的管理类
                System.Security.Cryptography.AesManaged aes = new System.Security.Cryptography.AesManaged();
                // Rfc2898DeriveBytes - 通过使用基于 HMACSHA1 的伪随机数生成器，实现基于密码的密钥派生功能 (PBKDF2 - 一种基于密码的密钥派生函数)
                // 通过 密码 和 salt 派生密钥
                System.Security.Cryptography.Rfc2898DeriveBytes rfc = new System.Security.Cryptography.Rfc2898DeriveBytes(pwdValue, salt);
                aes.BlockSize = aes.LegalBlockSizes[0].MaxSize;
                aes.KeySize = aes.LegalKeySizes[0].MaxSize;
                aes.Key = rfc.GetBytes(aes.KeySize / 8);
                aes.IV = rfc.GetBytes(aes.BlockSize / 8);
                // 用当前的 Key 属性和初始化向量 IV 创建对称加密器对象
                System.Security.Cryptography.ICryptoTransform encryptTransform = aes.CreateEncryptor();
                // 加密后的输出流
                using (System.IO.MemoryStream encryptStream = new System.IO.MemoryStream())
                {
                    // 将加密后的目标流（encryptStream）与加密转换（encryptTransform）相连接
                    using (System.Security.Cryptography.CryptoStream encryptor = new System.Security.Cryptography.CryptoStream
                         (encryptStream, encryptTransform, System.Security.Cryptography.CryptoStreamMode.Write))
                    {
                        // 将一个字节序列写入当前 CryptoStream （完成加密的过程）
                        encryptor.Write(data, 0, data.Length);
                        encryptor.Close();
                        // 将加密后所得到的流转换成字节数组，再用Base64编码将其转换为字符串
                        str = Convert.ToBase64String(encryptStream.ToArray());
                    }
                }
            }
            catch { }
            return str;
        }

        /// <summary>
        /// AES 解密
        /// </summary>
        /// <param name="input">加密后的字符串</param>
        /// <returns>加密前的字符串</returns>
        public static string DecryptAES(string input)
        {
            var str = string.Empty;
            try
            {
                byte[] encryptBytes = Convert.FromBase64String(input);
                byte[] salt = Encoding.UTF8.GetBytes(saltValue);
                System.Security.Cryptography.AesManaged aes = new System.Security.Cryptography.AesManaged();
                System.Security.Cryptography.Rfc2898DeriveBytes rfc = new System.Security.Cryptography.Rfc2898DeriveBytes(pwdValue, salt);
                aes.BlockSize = aes.LegalBlockSizes[0].MaxSize;
                aes.KeySize = aes.LegalKeySizes[0].MaxSize;
                aes.Key = rfc.GetBytes(aes.KeySize / 8);
                aes.IV = rfc.GetBytes(aes.BlockSize / 8);
                // 用当前的 Key 属性和初始化向量 IV 创建对称解密器对象
                System.Security.Cryptography.ICryptoTransform decryptTransform = aes.CreateDecryptor();
                // 解密后的输出流
                using (System.IO.MemoryStream decryptStream = new System.IO.MemoryStream())
                {
                    // 将解密后的目标流（decryptStream）与解密转换（decryptTransform）相连接
                    using (System.Security.Cryptography.CryptoStream decryptor = new System.Security.Cryptography.CryptoStream(
                         decryptStream, decryptTransform, System.Security.Cryptography.CryptoStreamMode.Write))
                    {
                        // 将一个字节序列写入当前 CryptoStream （完成解密的过程）
                        decryptor.Write(encryptBytes, 0, encryptBytes.Length);
                        decryptor.Close();
                        // 将解密后所得到的流转换为字符串
                        byte[] decryptBytes = decryptStream.ToArray();
                        str = UTF8Encoding.UTF8.GetString(decryptBytes, 0, decryptBytes.Length);
                    }
                }
            }
            catch { }
            return str;
        }
        #endregion

        #endregion

        /// <summary>
        /// -1:无效；0：移动；1：联通；2：电信手机；3：疑似小灵通；
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static int getMobileType(string mobile)
        {
            return mobile.xMobileType();
        }

        #region XML转义
        /// <summary>
        /// XML转义
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string EscapeXml(string str)
        {
            return UnEscapeXml(str).Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("'", "&apos;").Replace("\"", "&quot;");
        }

        public static string UnEscapeXml(string str)
        {
            if (str == null) return "";
            return str.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
        }
        #endregion

        #region URL编码、解码

        /// <summary>
        /// URL编码，使用System.Text.Encoding.UTF8
        /// HttpUtility.UrlEncode 会把空格转换为“+”，应该是“%20”
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string UrlEncode(string str)
        {
            return UrlEncode(str, System.Text.Encoding.UTF8);
        }

        /// <summary>
        ///  URL编码
        ///  HttpUtility.UrlEncode 会把空格转换为“+”，应该是“%20”
        /// </summary>
        /// <param name="str"></param>
        /// <param name="encoding"></param>
        /// <returns></returns>
        public static string UrlEncode(string str, System.Text.Encoding encoding)
        {
            return System.Web.HttpUtility.UrlEncode(str, encoding).Replace("+", "%20");
        }

        /// <summary>
        /// Url解码 使用System.Text.Encoding.UTF8
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string UrlDecode(string str)
        {
            return UrlDecode(str, System.Text.Encoding.UTF8);
        }
        /// <summary>
        ///  URL解码
        /// </summary>
        /// <param name="str"></param>
        /// <param name="encoding"></param>
        /// <returns></returns>
        public static string UrlDecode(string str, System.Text.Encoding encoding)
        {
            return System.Web.HttpUtility.UrlDecode(str, encoding);
        }

        #endregion

        #region 全角 半角
        /// <summary>
        /// 半角转全角
        /// 全角空格为12288，半角空格为32
        /// 其他字符半角(33-126)与全角(65281-65374)的对应关系是：均相差65248 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public static string ToSBC(string input)
        {
            char[] c = input.ToCharArray();
            for (int i = 0; i < c.Length; i++)
            {
                if (c[i] == 32)
                {
                    c[i] = (char)12288;
                    continue;
                }
                if (c[i] < 127)
                    c[i] = (char)(c[i] + 65248);
            }
            return new string(c);
        }
        /// <summary>
        /// 全角转半角
        /// 全角空格为12288，半角空格为32
        /// 其他字符半角(33-126)与全角(65281-65374)的对应关系是：均相差65248 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public static string ToDBC(string input)
        {
            char[] c = input.ToCharArray();
            for (int i = 0; i < c.Length; i++)
            {
                if (c[i] == 12288)
                {
                    c[i] = (char)32;
                    continue;
                }
                if (c[i] > 65280 && c[i] < 65375)
                    c[i] = (char)(c[i] - 65248);
            }
            return new string(c);
        }
        #endregion

        #region 类型转换
        /// <summary>
        /// 将对象格式化为XML
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="obj"></param>
        /// <param name="RootName"></param>
        /// <param name="Namespace"></param>
        /// <returns></returns>
        public static string ToXml<T>(T obj, string RootName = "Root", string Namespace = "")
        {
            string result = null;
            if (obj != null)
            {
                try
                {
                    using (MemoryStream ms = new MemoryStream())
                    {
                        using (StreamWriter sw = new StreamWriter(ms, Encoding.UTF8))
                        {
                            System.Xml.Serialization.XmlRootAttribute xRoot = new System.Xml.Serialization.XmlRootAttribute();
                            xRoot.ElementName = RootName;
                            xRoot.Namespace = Namespace;
                            xRoot.IsNullable = true;

                            System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(T), xRoot);
                            System.Xml.Serialization.XmlSerializerNamespaces xsn = new System.Xml.Serialization.XmlSerializerNamespaces();
                            //empty namespaces
                            xsn.Add(String.Empty, String.Empty);
                            xs.Serialize(sw, obj, xsn);
                            result = Encoding.UTF8.GetString(ms.ToArray());
                        }
                    }
                }
                catch { }
            }
            return result;
        }
        /// <summary>
        /// 序列化为XML
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="RootName"></param>
        /// <param name="Namespace"></param>
        /// <returns></returns>
        public static string ToXmlA(object obj, string RootName = "Root", string Namespace = "")
        {
            string result = null;
            if (obj != null)
            {
                try
                {
                    if (obj is System.Collections.IDictionary)
                    {
                        var t = obj as System.Collections.IDictionary;
                        List<KeyValue<object, object>> Dictionary = new List<KeyValue<object, object>>();
                        foreach (var key in t.Keys)
                        {
                            Dictionary.Add(new KeyValue<object, object>(key, t[key]));
                        }
                        obj = Dictionary;
                    }
                    using (MemoryStream ms = new MemoryStream())
                    {
                        using (StreamWriter sw = new StreamWriter(ms, Encoding.UTF8))
                        {
                            System.Xml.Serialization.XmlRootAttribute xRoot = new System.Xml.Serialization.XmlRootAttribute();
                            xRoot.ElementName = RootName;
                            xRoot.Namespace = Namespace;
                            xRoot.IsNullable = true;

                            System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(obj.GetType(), xRoot);
                            System.Xml.Serialization.XmlSerializerNamespaces xsn = new System.Xml.Serialization.XmlSerializerNamespaces();
                            //empty namespaces
                            xsn.Add(String.Empty, String.Empty);
                            xs.Serialize(sw, obj, xsn);
                            result = Encoding.UTF8.GetString(ms.ToArray());
                        }
                    }
                }
                catch { }
            }
            return result;
        }
        /// <summary>
        /// 对象转JSON
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static string ToJson(object obj)
        {
            string result = null;
            try
            {
                if (obj is System.Collections.IDictionary)
                {
                    var t = obj as System.Collections.IDictionary;
                    List<KeyValue<object, object>> Dictionary = new List<KeyValue<object, object>>();
                    foreach (var key in t.Keys)
                    {
                        Dictionary.Add(new KeyValue<object, object>(key, t[key]));
                    }
                    obj = Dictionary;
                }
                result = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(obj);
            }
            catch { }
            return result;
        }

        /// <summary>
        /// 将值转换为指定类型
        /// </summary>
        /// <typeparam name="T">要转换到的类型</typeparam>
        /// <param name="value">值</param>
        /// <param name="defaultValue">默认值 default(T)</param>
        /// <returns></returns>
        public static T To<T>(object value, T defaultValue = default(T))
        {
            T result = defaultValue;
            try
            {
                result = (T)To(value, typeof(T));
            }
            catch { }
            return result;
        }
        /// <summary>
        /// 将值转换为指定类型
        /// </summary>
        /// <param name="value">值</param>
        /// <param name="type">类型</param>
        /// <returns></returns>
        public static object To(object value, Type type)
        {
            try
            {
                return ChangeType(value, type);
            }
            catch
            {
                return Activator.CreateInstance(type);
            }
        }
        static object ChangeType(object value, Type type)
        {
            if (value == null && type.IsGenericType) return Activator.CreateInstance(type);
            if (value == null) return null;
            if (type == value.GetType()) return value;
            if (type.IsEnum)
            {
                if (value is string)
                    return Enum.Parse(type, value as string);
                else
                    return Enum.ToObject(type, value);
            }
            if (!type.IsInterface && type.IsGenericType)
            {
                Type innerType = type.GetGenericArguments()[0];
                object innerValue = ChangeType(value, innerType);
                return Activator.CreateInstance(type, new object[] { innerValue });
            }
            if (value is string && type == typeof(Guid)) return new Guid(value as string);
            if (value is string && type == typeof(Version)) return new Version(value as string);
            if (!(value is IConvertible)) return value;
            return Convert.ChangeType(value, type);
        }
        #endregion

        #region Post Data Xml Get
        /// <summary>
        /// WebClient http post xml 
        /// </summary>
        /// <param name="Url"></param>
        /// <param name="xml"></param>
        /// <returns></returns>
        public static string postXMLByWebClient(string Url, string xml)
        {
            byte[] postData = System.Text.Encoding.UTF8.GetBytes(xml);
            System.Net.WebClient wc = new System.Net.WebClient();
            wc.Credentials = System.Net.CredentialCache.DefaultCredentials;
            wc.Headers.Add("Content-Type", "text/xml");
            wc.Headers.Add("ContentLength", postData.Length.ToString());
            wc.Encoding = System.Text.Encoding.UTF8;
            byte[] responseData = wc.UploadData(Url, "POST", postData);
            string result = System.Text.Encoding.UTF8.GetString(responseData);
            return result;
        }
        /// <summary>
        /// WebClient http post data 
        /// </summary>
        /// <param name="Url"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public static string postDataByWebClient(string Url, string data)
        {
            byte[] postData = System.Text.Encoding.UTF8.GetBytes(data);
            System.Net.WebClient webClient = new System.Net.WebClient();
            webClient.Credentials = System.Net.CredentialCache.DefaultCredentials;
            webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
            webClient.Headers.Add("ContentLength", postData.Length.ToString());
            byte[] responseData = webClient.UploadData(Url, "POST", postData);
            string result = System.Text.Encoding.UTF8.GetString(responseData);
            return result;
        }
        /// <summary>
        /// WebClient http get 
        /// </summary>
        /// <param name="Url"></param>
        /// <returns></returns>
        public static string getDataByWebClient(string Url)
        {
            WebClient wc = new WebClient();
            wc.Credentials = CredentialCache.DefaultCredentials;//获取或设置用于对向Internet资源的请求进行身份验证的网络凭据。
            Byte[] data = wc.DownloadData(Url);//从指定网站下载数据
            string result = Encoding.UTF8.GetString(data);
            return result;
        }
        /// <summary>
        /// WebRequest http post xml 
        /// </summary>
        /// <param name="Url"></param>
        /// <param name="xml"></param>
        /// <returns></returns>
        public static string postXMLByHttpWebRequest(string Url, string xml)
        {
            string result = null;
            byte[] postData = System.Text.Encoding.UTF8.GetBytes(xml);
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);
            req.Method = "POST";
            req.ContentType = "text/xml;charset=utf-8";
            req.ContentLength = postData.Length;
            using (Stream sw = req.GetRequestStream())
            {
                sw.Write(postData, 0, postData.Length);
                sw.Flush();
                sw.Close();
            }
            HttpWebResponse res = (HttpWebResponse)req.GetResponse();
            using (Stream sr = res.GetResponseStream())
            {
                using (StreamReader srr = new StreamReader(sr, System.Text.Encoding.UTF8))
                {
                    result = srr.ReadToEnd();
                    srr.Close();
                }
                sr.Close();
            }
            return result;
        }

        /// <summary>
        /// Http GET UTF8编码
        /// </summary>
        /// <param name="Url">地址</param>
        /// <param name="timeOut">超时时间</param>
        /// <returns></returns>
        public static string HttpGet(string Url, int timeOut = 100)
        {
            return HttpGet(Url, Encoding.UTF8, timeOut);
        }

        /// <summary>
        ///  Http GET
        /// </summary>
        /// <param name="Url">地址</param>
        /// <param name="encoding">System.Text.Encoding</param>
        /// <param name="timeOut">超时时间</param>
        /// <returns></returns>
        public static string HttpGet(string Url, System.Text.Encoding encoding, int timeOut = 100)
        {
            //ServicePointManager.DefaultConnectionLimit = 512;
            //ServicePointManager.Expect100Continue = false;
            //ServicePointManager.UseNagleAlgorithm = false;
            //ServicePointManager.CheckCertificateRevocationList = false;
            //GC.Collect();
            using (var webClient = new WebClientEx(timeOut))
            {
                webClient.Credentials = CredentialCache.DefaultCredentials;//获取或设置用于对向Internet资源的请求进行身份验证的网络凭据。
                Byte[] data = webClient.DownloadData(Url);//从指定网站下载数据      
                string result = encoding.GetString(data);
                return result;
            }
        }

        /// <summary>
        /// Http Post UTF8编码
        /// </summary>
        /// <param name="Url">地址</param>
        /// <param name="Data">数据</param>
        /// <param name="ContentType">xml：text/xml;charset=utf-8  json：application/json；  query：application/x-www-form-urlencoded</param>
        /// <returns></returns>
        public static string HttpPost(string Url, string Data, string ContentType)
        {
            return HttpPost(Url, Data, ContentType, Encoding.UTF8);
        }

        /// <summary>
        /// System.Net.WebClient Post UTF8编码
        /// </summary>
        /// <param name="Url">地址</param>
        /// <param name="Data">数据</param>
        /// <param name="ContentType">ContentType</param>
        /// <param name="Headers">自定义请求头</param>
        /// <param name="timeOut">超时时间</param>
        /// <returns></returns>
        public static string HttpPostByWebClient(string Url, string Data, string ContentType, Dictionary<string, string> Headers = null, int timeOut = 100)
        {
            return HttpPostByWebClient(Url, Data, ContentType, System.Text.Encoding.UTF8, Headers, timeOut);
        }

        /// <summary>
        /// System.Net.WebClient Post
        /// </summary>
        /// <param name="Url">地址</param>
        /// <param name="Data">数据</param>
        /// <param name="ContentType">ContentType</param>
        /// <param name="encoding">编码方式</param>
        /// <param name="Headers">自定义请求头</param>
        /// <param name="timeOut">超时时间</param>
        /// <returns></returns>
        public static string HttpPostByWebClient(string Url, string Data, string ContentType, System.Text.Encoding encoding, Dictionary<string, string> Headers = null, int timeOut = 100)
        {
            byte[] postData = encoding.GetBytes(Data);
            using (var webClient = new WebClientEx(timeOut))
            {
                if (Url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
                {
                    System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback((sender, certificate, chain, errors) =>
                    {
                        return true;
                    });
                }
                webClient.Credentials = System.Net.CredentialCache.DefaultCredentials;
                webClient.Headers.Add("Content-Type", ContentType);
                webClient.Headers.Add("ContentLength", postData.Length.ToString());
                if (Headers != null && Headers.Keys.Count > 0)
                {
                    foreach (var k in Headers)
                    {
                        webClient.Headers.Add(k.Key, k.Value);
                    }
                }
                byte[] responseData = webClient.UploadData(Url, "POST", postData);
                string result = encoding.GetString(responseData);
                return result;
            }
        }

        /// <summary>
        /// Http Post
        /// </summary>
        /// <param name="Url">地址</param>
        /// <param name="Data">数据</param>
        /// <param name="ContentType">xml：text/xml;charset=utf-8  json：application/json；  query：application/x-www-form-urlencoded</param>
        /// <param name="encoding">System.Text.Encoding</param>
        /// <returns></returns>
        public static string HttpPost(string Url, string Data, string ContentType, System.Text.Encoding encoding)
        {
            ServicePointManager.DefaultConnectionLimit = 512;
            GC.Collect();
            Url = Url == null ? "" : Url.Trim();
            string Result = null;
            byte[] postData = encoding.GetBytes(Data);

            System.Net.HttpWebRequest request = null;
            //如果是发送HTTPS请求  
            if (Url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
            {
                System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback((sender, certificate, chain, errors) =>
                {
                    return true;
                });
                request = System.Net.WebRequest.Create(Url) as System.Net.HttpWebRequest;
                //System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
                request.ProtocolVersion = System.Net.HttpVersion.Version10;
            }
            else
            {
                request = System.Net.WebRequest.Create(Url) as System.Net.HttpWebRequest;
            }
            //request.KeepAlive = false;
            request.Method = "POST";
            request.ContentType = ContentType;
            request.ContentLength = postData.Length;
            using (System.IO.Stream stream = request.GetRequestStream())
            {
                stream.Write(postData, 0, postData.Length);
                stream.Flush();
                stream.Close();
            }
            System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
            using (System.IO.Stream stream = response.GetResponseStream())
            {
                using (System.IO.StreamReader streamReader = new System.IO.StreamReader(stream, encoding))
                {
                    Result = streamReader.ReadToEnd();
                    streamReader.Close();
                }
                stream.Close();
            }
            try
            {
                if (response != null)
                {
                    response.Close();
                    response = null;
                }
                if (request != null)
                {
                    request.Abort();
                    request = null;
                }
            }
            finally
            {
                GC.Collect();
            }
            return Result;
        }

        #region WebRequest Post/Get
        /// <summary>
        /// WebRequest Get UTF-8编码
        /// </summary>
        /// <param name="Url">地址</param>
        /// <param name="timeOut">超时时间，以秒为单位</param>
        /// <returns></returns>
        public static string HttpGetByWebRequest(string Url, int timeOut = 100)
        {
            return HttpGetByWebRequest(Url, System.Text.Encoding.UTF8, timeOut);
        }
        /// <summary>
        ///  WebRequest Get
        /// </summary>
        /// <param name="Url">地址</param>
        /// <param name="encoding">编码</param>
        /// <param name="timeOut">超时时间，以秒为单位</param>
        /// <returns></returns>
        public static string HttpGetByWebRequest(string Url, System.Text.Encoding encoding, int timeOut = 100)
        {
            var aResult = string.Empty;

            HttpWebRequest httpWebRequest = null;
            WebResponse webResponse = null;
            try
            {
                GC.Collect();
                if (Url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
                {
                    ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, errors) => true);
                    httpWebRequest = (HttpWebRequest)WebRequest.Create(Url);
                    httpWebRequest.ProtocolVersion = HttpVersion.Version10;
                }
                else
                {
                    httpWebRequest = (HttpWebRequest)WebRequest.Create(Url);
                }
                httpWebRequest.ServicePoint.Expect100Continue = false;
                httpWebRequest.ServicePoint.UseNagleAlgorithm = false;
                httpWebRequest.ServicePoint.ConnectionLimit = 65500;
                httpWebRequest.AllowWriteStreamBuffering = false;
                httpWebRequest.Proxy = null;
                httpWebRequest.Timeout = timeOut * 1000;
                httpWebRequest.ReadWriteTimeout = timeOut * 1000;
                //httpWebRequest.KeepAlive = false;
                httpWebRequest.Method = "GET";
                webResponse = httpWebRequest.GetResponse();
                using (Stream responseStream = webResponse.GetResponseStream())
                {
                    using (System.IO.StreamReader reader = new System.IO.StreamReader(responseStream, encoding))
                    {
                        aResult = reader.ReadToEnd();
                    }
                    responseStream.Flush();
                    responseStream.Close();
                    responseStream.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                try
                {
                    if (webResponse != null)
                    {
                        webResponse.Close();
                        webResponse = null;
                    }
                    if (httpWebRequest != null)
                    {
                        httpWebRequest.Abort();
                        httpWebRequest = null;
                    }
                    GC.Collect();
                }
                catch { }
            }
            return aResult;
        }
        /// <summary>
        /// WebRequest Post UTF-8编码
        /// </summary>
        /// <param name="Url">地址</param>
        /// <param name="Data">Post数据</param>
        /// <param name="ContentType">类型 xml：text/xml;charset=utf-8  json：application/json；  query：application/x-www-form-urlencoded</param>
        /// <param name="Headers">自定义请求头</param>
        /// <param name="timeOut">超时时间，以秒为单位</param>
        /// <returns></returns>
        public static string HttpPostByWebRequest(string Url, string Data, string ContentType, Dictionary<string, string> Headers = null, int timeOut = 100)
        {
            return HttpPostByWebRequest(Url, Data, ContentType, System.Text.Encoding.UTF8, Headers, timeOut);
        }
        /// <summary>
        /// WebRequest Post
        /// </summary>
        /// <param name="Url">地址</param>
        /// <param name="Data">Post数据</param>
        /// <param name="ContentType">类型 xml：text/xml;charset=utf-8  json：application/json；  query：application/x-www-form-urlencoded</param>
        /// <param name="encoding">编码方式</param>
        /// <param name="Headers">自定义请求头</param>
        /// <param name="timeOut">超时时间，以秒为单位</param>
        /// <returns></returns>
        public static string HttpPostByWebRequest(string Url, string Data, string ContentType, System.Text.Encoding encoding, Dictionary<string, string> Headers = null, int timeOut = 100)
        {
            var aResult = string.Empty;

            HttpWebRequest httpWebRequest = null;
            WebResponse webResponse = null;
            try
            {
                byte[] postData = encoding.GetBytes(Data);
                GC.Collect();
                if (Url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
                {
                    ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, errors) => true);
                    httpWebRequest = (HttpWebRequest)WebRequest.Create(Url);
                    httpWebRequest.ProtocolVersion = HttpVersion.Version10;
                }
                else
                {
                    httpWebRequest = (HttpWebRequest)WebRequest.Create(Url);
                }
                httpWebRequest.ServicePoint.Expect100Continue = false;
                httpWebRequest.ServicePoint.UseNagleAlgorithm = false;
                httpWebRequest.ServicePoint.ConnectionLimit = 65500;
                httpWebRequest.AllowWriteStreamBuffering = false;
                httpWebRequest.Proxy = null;
                httpWebRequest.Timeout = timeOut * 1000;
                httpWebRequest.ReadWriteTimeout = timeOut * 1000;
                //httpWebRequest.KeepAlive = false;
                httpWebRequest.ProtocolVersion = HttpVersion.Version11;

                httpWebRequest.Method = "POST";
                httpWebRequest.ContentType = ContentType;
                httpWebRequest.ContentLength = postData.Length;
                if (Headers != null && Headers.Keys.Count > 0)
                {
                    foreach (var k in Headers)
                    {
                        httpWebRequest.Headers.Add(k.Key, k.Value);
                    }
                }
                using (System.IO.Stream stream = httpWebRequest.GetRequestStream())
                {
                    stream.Write(postData, 0, postData.Length);
                    stream.Flush();
                    stream.Close();
                }
                webResponse = httpWebRequest.GetResponse();
                using (Stream responseStream = webResponse.GetResponseStream())
                {
                    using (System.IO.StreamReader reader = new System.IO.StreamReader(responseStream, encoding))
                    {
                        aResult = reader.ReadToEnd();
                    }
                    responseStream.Flush();
                    responseStream.Close();
                    responseStream.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                try
                {
                    if (webResponse != null)
                    {
                        webResponse.Close();
                        webResponse = null;
                    }
                    if (httpWebRequest != null)
                    {
                        httpWebRequest.Abort();
                        httpWebRequest = null;
                    }
                    GC.Collect();
                }
                catch { }
            }
            return aResult;
        }

        public static string HttpPostFileByWebRequest(string Url, string fileName, byte[] postData, System.Text.Encoding encoding, Dictionary<string, string> Headers = null, int timeOut = 100)
        {
            var aResult = string.Empty;

            HttpWebRequest httpWebRequest = null;
            WebResponse webResponse = null;
            try
            {
                GC.Collect();
                if (Url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
                {
                    ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, errors) => true);
                    httpWebRequest = (HttpWebRequest)WebRequest.Create(Url);
                    httpWebRequest.ProtocolVersion = HttpVersion.Version10;
                }
                else
                {
                    httpWebRequest = (HttpWebRequest)WebRequest.Create(Url);
                }
                httpWebRequest.ServicePoint.Expect100Continue = false;
                httpWebRequest.ServicePoint.UseNagleAlgorithm = false;
                httpWebRequest.ServicePoint.ConnectionLimit = 65500;
                httpWebRequest.AllowWriteStreamBuffering = false;
                httpWebRequest.Proxy = null;
                httpWebRequest.Timeout = timeOut * 1000;
                httpWebRequest.ReadWriteTimeout = timeOut * 1000;
                //httpWebRequest.KeepAlive = false;
                httpWebRequest.ProtocolVersion = HttpVersion.Version11;

                httpWebRequest.Method = "POST";
                string boundary = DateTime.Now.Ticks.ToString("X");//随机分割线
                httpWebRequest.ContentType = "multipart/form-data;charset=utf-8;boundary=" + boundary;

                byte[] itemBoundaryBytes = encoding.GetBytes("\r\n--" + boundary + "\r\n");
                byte[] endBoundaryBytes = encoding.GetBytes("\r\n--" + boundary + "--\r\n");
                byte[] postHeaderBytes = encoding.GetBytes("Content-Disposition:form-data;name=\"media\";filename=\"{0}\"\r\nContent-Type:application/octet-stream\r\n\r\n".xFormat(fileName));

                httpWebRequest.ContentLength = itemBoundaryBytes.Length + endBoundaryBytes.Length + postHeaderBytes.Length + postData.Length;
                if (Headers != null && Headers.Keys.Count > 0)
                {
                    foreach (var k in Headers)
                    {
                        httpWebRequest.Headers.Add(k.Key, k.Value);
                    }
                }
                using (System.IO.Stream stream = httpWebRequest.GetRequestStream())
                {
                    stream.Write(itemBoundaryBytes, 0, itemBoundaryBytes.Length);
                    stream.Write(postHeaderBytes, 0, postHeaderBytes.Length);
                    stream.Write(postData, 0, postData.Length);
                    stream.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
                    stream.Flush();
                    stream.Close();
                }
                webResponse = httpWebRequest.GetResponse();
                using (Stream responseStream = webResponse.GetResponseStream())
                {
                    using (System.IO.StreamReader reader = new System.IO.StreamReader(responseStream, encoding))
                    {
                        aResult = reader.ReadToEnd();
                    }
                    responseStream.Flush();
                    responseStream.Close();
                    responseStream.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                try
                {
                    if (webResponse != null)
                    {
                        webResponse.Close();
                        webResponse = null;
                    }
                    if (httpWebRequest != null)
                    {
                        httpWebRequest.Abort();
                        httpWebRequest = null;
                    }
                    GC.Collect();
                }
                catch { }
            }
            return aResult;
        }
        #endregion

        #endregion

        /// <summary>
        /// 使用cmd调用外部应用程序
        /// </summary>
        /// <param name="ExeFilePath">可执行文件路径</param>
        /// <param name="ExecArg">执行参数</param>
        /// <param name="DataReceiveHandler">重定向输出</param>
        public static void ExcuteProcess(string ExeFilePath, string ExecArg, System.Diagnostics.DataReceivedEventHandler DataReceiveHandler)
        {
            using (System.Diagnostics.Process process = new System.Diagnostics.Process())
            {
                process.StartInfo.FileName = ExeFilePath;
                process.StartInfo.Arguments = ExecArg;

                process.StartInfo.UseShellExecute = false;    //输出信息重定向
                process.StartInfo.CreateNoWindow = true;
                process.StartInfo.RedirectStandardError = true;
                process.StartInfo.RedirectStandardOutput = true;

                process.OutputDataReceived += DataReceiveHandler;
                process.ErrorDataReceived += DataReceiveHandler;

                process.Start();                    //启动线程
                process.BeginOutputReadLine();
                process.BeginErrorReadLine();
                process.WaitForExit();            //等待进程结束
            }
        }

        #region Json

        public static string ObjectToJson(object obj)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(obj.GetType());
                serializer.WriteObject(ms, obj);
                ms.Position = 0;
                using (StreamReader reader = new StreamReader(ms))
                {
                    string json = reader.ReadToEnd();
                    string p = @"\\/Date\((\d+)\+\d+\)\\/";
                    MatchEvaluator evaluator = new MatchEvaluator(ConvertJsonDateToDateString);
                    //对时间进行处理，需要引用System.Text.RegularExpressions;命名空间
                    Regex reg = new Regex(p);
                    json = reg.Replace(json, evaluator);
                    return json;
                }
            }
        }

        public static string ObjectToJson<T>(T t)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(T));
                serializer.WriteObject(ms, t);
                ms.Position = 0;
                using (StreamReader reader = new StreamReader(ms))
                {
                    string json = reader.ReadToEnd();
                    string p = @"\\/Date\((\d+)\+\d+\)\\/";
                    MatchEvaluator evaluator = new MatchEvaluator(ConvertJsonDateToDateString);
                    //对时间进行处理，需要引用System.Text.RegularExpressions;命名空间
                    Regex reg = new Regex(p);
                    json = reg.Replace(json, evaluator);
                    return json;
                }

            }
        }

        public static T JsonToObject<T>(string json)
        {
            string p = @"\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}";
            MatchEvaluator evaluator = new MatchEvaluator(ConvertDateStringToJsonDate);    //对时间进行处理
            Regex reg = new Regex(p);
            json = reg.Replace(json, evaluator);
            using (MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(json)))
            {
                System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(T));
                T data = (T)serializer.ReadObject(ms);
                return data;
            }
        }

        /// <summary>
        /// 将Json时间转换成时间字符
        /// </summary>
        private static string ConvertJsonDateToDateString(Match m)　　//对时间进行序列化处理
        {
            string result = string.Empty;
            DateTime dt = new DateTime(1970, 1, 1);
            dt = dt.AddMilliseconds(long.Parse(m.Groups[1].Value));
            dt = dt.ToLocalTime();
            result = dt.ToString("yyyy-MM-dd HH:mm:ss");
            return result;
        }

        /// <summary>
        /// 将时间字符转换成JSON时间
        /// </summary>
        private static string ConvertDateStringToJsonDate(Match m)
        {
            string result = string.Empty;
            DateTime dt = DateTime.Parse(m.Groups[0].Value);
            dt = dt.ToUniversalTime();
            TimeSpan ts = dt - DateTime.Parse("1970-01-01");
            result = string.Format("\\/Date({0}+0800)\\/", ts.TotalMilliseconds);
            return result;
        }

        public static DateTime ConvertJsonDateToDateTime(string jsonDate)
        {
            string value = jsonDate.Substring(6, jsonDate.Length - 8);
            DateTimeKind kind = DateTimeKind.Utc;
            int index = value.IndexOf('+', 1);
            if (index == -1)
                index = value.IndexOf('-', 1);
            if (index != -1)
            {
                kind = DateTimeKind.Local;
                value = value.Substring(0, index);
            }
            long javaScriptTicks = long.Parse(value, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture);
            long InitialJavaScriptDateTicks = (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).Ticks;
            DateTime utcDateTime = new DateTime((javaScriptTicks * 10000) + InitialJavaScriptDateTicks, DateTimeKind.Utc);
            DateTime dateTime;
            switch (kind)
            {
                case DateTimeKind.Unspecified:
                    dateTime = DateTime.SpecifyKind(utcDateTime.ToLocalTime(), DateTimeKind.Unspecified);
                    break;
                case DateTimeKind.Local:
                    dateTime = utcDateTime.ToLocalTime();
                    break;
                default:
                    dateTime = utcDateTime;
                    break;
            }
            return dateTime;
        }
        #endregion

        #region HTML
        /// <summary>
        /// 移除HTML格式
        /// </summary>
        /// <param name="Htmlstring"></param>
        /// <returns></returns>
        public static string ReplaceHtmlTag(string Htmlstring)  //替换HTML标记
        {
            //删除脚本
            Htmlstring = Regex.Replace(Htmlstring, @"<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase);
            //删除样式
            Htmlstring = Regex.Replace(Htmlstring, @"<style[^>]*?>.*?</style>", "", RegexOptions.IgnoreCase);

            //删除HTML
            Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"<!--.*", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(nbsp|#160);", " ", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"<img[^>]*>;", "", RegexOptions.IgnoreCase);
            Htmlstring.Replace("<", "");
            Htmlstring.Replace(">", "");
            Htmlstring.Replace("\r\n", "");
            return Htmlstring;
        }
        #endregion

        /// <summary>
        /// 写日志 
        /// </summary>
        /// <param name="path">路径</param>
        /// <param name="log">内容</param>
        public static void WriteLog(string path, string log)
        {
            try
            {
                if (!File.Exists(path))
                {
                    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path, false, Encoding.UTF8))
                    {
                        sw.WriteLine(log);
                    }
                }
                else
                {
                    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path, true, Encoding.UTF8))
                    {
                        sw.WriteLine(log);
                    }
                }
            }
            catch { }
        }
        /// <summary>
        /// 写日志文件
        /// </summary>
        /// <param name="path">路径</param>
        /// <param name="fileName">文件名称</param>
        /// <param name="log">要写入的日志</param>
        public static void WriteLog(string path, string fileName, string log)
        {
            try
            {
                if (!path.EndsWith(@"\")) path += @"\";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                WriteLog(path + fileName, log);
            }
            catch { }
        }

        /// <summary>
        /// 取ipv4地址
        /// </summary>
        public static string GetIp()
        {
            string Ipv4 = string.Empty;
            try
            {
                foreach (System.Net.IPAddress IPA in System.Net.Dns.GetHostAddresses(System.Web.HttpContext.Current.Request.UserHostAddress))
                {
                    if (IPA.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                    {
                        Ipv4 = IPA.ToString();
                        break;
                    }
                }
            }
            catch { }
            try
            {
                if (Ipv4 == String.Empty)
                {
                    foreach (System.Net.IPAddress IPA in System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName()))
                    {
                        if (IPA.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                        {
                            Ipv4 = IPA.ToString();
                            break;
                        }
                    }
                }
            }
            catch { }
            try
            {
                if (Ipv4 == string.Empty)
                {
                    Ipv4 = System.Web.HttpContext.Current.Request.UserHostAddress.Trim();
                }
            }
            catch { }
            return Ipv4;
        }

        #region
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objs">值</param>
        /// <param name="strFormat">DataTable.Select语法 {0}=1 and {1}>2</param>
        /// <returns></returns>
        public static bool ValidCondition(object[] objs, string strFormat)
        {
            bool bl = false;
            DataTable dt = null;
            try
            {
                List<string> Columns = new List<string>();
                dt = new DataTable();
                for (int i = 0; i < objs.Length; i++)
                {
                    var colName = "Col" + i;
                    dt.Columns.Add(colName, objs[i] == null ? typeof(string) : objs[i].GetType());
                    Columns.Add(colName);
                }
                dt.Rows.Add(objs);
                strFormat = string.Format(strFormat, Columns.ToArray());
                var rows = dt.Select(strFormat);
                if (rows.Length > 0)
                {
                    bl = true;
                }
            }
            catch { }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                    dt = null;
                }
            }
            return bl;
        }
        #endregion


        /// <summary>
        /// 取汉字拼音首字母
        /// </summary>
        /// <param name="strText">字符串</param>
        /// <returns></returns>
        public static string GetChineseSpell(string strText)
        {
            string strChineseFirstPY = "YDYQSXMWZSSXJBYMGCCZQPSSQBYCDSCDQLDYLYBSSJGYZZJJFKCCLZDHWDWZJLJPFYYNWJJTMYHZWZHFLZPPQHGSCYYYNJQYXXGJ" + "HHSDSJNKKTMOMLCRXYPSNQSECCQZGGLLYJLMYZZSECYKYYHQWJSSGGYXYZYJWWKDJHYCHMYXJTLXJYQBYXZLDWRDJRWYSRLDZJPC"
+ "BZJJBRCFTLECZSTZFXXZHTRQHYBDLYCZSSYMMRFMYQZPWWJJYFCRWFDFZQPYDDWYXKYJAWJFFXYPSFTZYHHYZYSWCJYXSCLCXXWZ"
+ "ZXNBGNNXBXLZSZSBSGPYSYZDHMDZBQBZCWDZZYYTZHBTSYYBZGNTNXQYWQSKBPHHLXGYBFMJEBJHHGQTJCYSXSTKZHLYCKGLYSMZ"
+ "XYALMELDCCXGZYRJXSDLTYZCQKCNNJWHJTZZCQLJSTSTBNXBTYXCEQXGKWJYFLZQLYHYXSPSFXLMPBYSXXXYDJCZYLLLSJXFHJXP"
+ "JBTFFYABYXBHZZBJYZLWLCZGGBTSSMDTJZXPTHYQTGLJSCQFZKJZJQNLZWLSLHDZBWJNCJZYZSQQYCQYRZCJJWYBRTWPYFTWEXCS"
+ "KDZCTBZHYZZYYJXZCFFZZMJYXXSDZZOTTBZLQWFCKSZSXFYRLNYJMBDTHJXSQQCCSBXYYTSYFBXDZTGBCNSLCYZZPSAZYZZSCJCS"
+ "HZQYDXLBPJLLMQXTYDZXSQJTZPXLCGLQTZWJBHCTSYJSFXYEJJTLBGXSXJMYJQQPFZASYJNTYDJXKJCDJSZCBARTDCLYJQMWNQNC"
+ "LLLKBYBZZSYHQQLTWLCCXTXLLZNTYLNEWYZYXCZXXGRKRMTCNDNJTSYYSSDQDGHSDBJGHRWRQLYBGLXHLGTGXBQJDZPYJSJYJCTM"
+ "RNYMGRZJCZGJMZMGXMPRYXKJNYMSGMZJYMKMFXM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JXXTMZYYLTXXYPZLXYJZYZYYPNHMYMDYYL"
+ "BLHLSYYQQLLNJJYMSOYQBZGDLYXYLCQYXTSZEGXHZGLHWBLJHEYXTWQMAKBPQCGYSHHEGQCMWYYWLJYJHYYZLLJJYLHZYHMGSLJL"
+ "JXCJJYCLYCJPCPZJZJMMYLCQLNQLJQJSXYJMLSZLJQLYCMMHCFMMFPQQMFYLQMCFFQMMMMHMZNFHHJGTTHHKHSLNCHHYQDXTMMQD"
+ "CYZYXYQMYQYLTDCYYYZAZZCYMZYDLZFFFMMYCQZWZZMABTBYZTDMNZZGGDFTYPCGQYTTSSFFWFDTZQSSYSTWXJHXYTSXXYLBYQHW"
+ "WKXHZXWZNNZZJZJJQJCCCHYYXBZXZCYZTLLCQXYNJYCYYCYNZZQYYYEWYCZDCJYCCHYJLBTZYYCQWMPWPYMLGKDLDLGKQQBGYCHJ"
+ "XY";
            if (strText == null || strText.Length == 0)
                return strText;
            System.Text.StringBuilder myStr = new System.Text.StringBuilder();
            foreach (char vChar in strText)
            {
                if ((int)vChar >= 19968 && (int)vChar <= 40869)
                {
                    // 对可以查找的汉字计算它的首拼音字母的位置，然后输出
                    myStr.Append(strChineseFirstPY[(int)vChar - 19968]);
                }
                else
                {
                    if ((vChar >= 'a' && vChar <= 'z') || (vChar >= 'A' && vChar <= 'Z'))
                    {
                        myStr.Append(char.ToUpper(vChar));
                    }
                    else
                    {
                        myStr.Append(vChar);
                    }
                }
            }
            return myStr.ToString();
        }

    }
}
